// 用户可访问营业点
import { DataTypes, UUIDV4 } from 'sequelize';
import { MySqlModel, getSequelize } from '../db';

class UserOutlets extends MySqlModel {

}

UserOutlets.init({
  id: {
    type: DataTypes.UUID, unique: 'id', allowNull: false, defaultValue: UUIDV4, validate: { isUUID: 4 }, primaryKey: true, comment: '主键', editable: false
  },
  user_id: {
    type: DataTypes.UUID, allowNull: false, unique: 'user_hotel_outlet_id', validate: { isUUID: 4 }, comment: '用户', editable: false
  },
  hotel_id: {
    type: DataTypes.UUID, allowNull: false, unique: 'user_hotel_outlet_id', validate: { isUUID: 4 }, comment: '主体', editable: false
  },
  outlet_id: {
    type: DataTypes.UUID, allowNull: false, unique: 'user_hotel_outlet_id', validate: { isUUID: 4 }, comment: '营业点', editable: false
  },
  created_id: {
    type: DataTypes.UUID, allowNull: false, validate: { isUUID: 4 }, comment: '创建用户', editable: false
  },
  created_at: {
    type: DataTypes.DATE, allowNull: false, editable: false, comment: '创建时间'
  },
  updated_at: {
    type: DataTypes.DATE, allowNull: false, editable: false, comment: '更新时间'
  }
}, {
  sequelize: getSequelize(),
  tableName: 'user_outlets',
  comment: '用户主体营业点表'
});

export default UserOutlets;
